﻿<Window x:Class="Deployment.Data.UI.Dialogs.AbstractDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Name="Dialog"
        Title="AbstractDialog" 
        Height="300" Width="300" 
        WindowStartupLocation="CenterOwner" 
        SizeToContent="WidthAndHeight" 
        ResizeMode="NoResize">
    <DockPanel LastChildFill="True" Margin="8">
        <StackPanel DockPanel.Dock="Bottom"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button IsCancel="True" Content="Cancel"
                    Margin="2" Padding="2"/>
            <Button IsDefault="True" Content="Ok"
                    Margin="2" Padding="2"
                    Click="OkClicked">
                <Button.Style>
                    <Style>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=grp_ContentControl, Path=Content}"
                                         Value="{x:Null}">
                                <Setter Property="Button.IsEnabled"
                                        Value="False"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding ElementName=grp_ContentControl, Path=Content.ContentOk}"
                                         Value="False">
                                <Setter Property="Button.IsEnabled"
                                        Value="False"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
        <GroupBox Content="{Binding ContentControl, ElementName=Dialog}" x:Name="grp_ContentControl"/>
    </DockPanel>
</Window>
